//Erstellt von Moritz Liepe
package main.editor;

import main.Activator;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.handlers.HandlerUtil;


public class StopHandler extends AbstractHandler 
{

	@Override
	public Object execute(ExecutionEvent event) throws ExecutionException 
	{
		VOSEditor vosEditor;
		IEditorPart page = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActiveEditor();
		if((page != null) && (page instanceof VOSEditor))
		{
			vosEditor = (VOSEditor)page;
			Activator.getDefault().getSimulationController().stopEditor(vosEditor);
		}
		
		return null;
	}

}
